{*include file="template/admin_head.htm"*}

<table id="containtable" cellspacing="0" cellpadding="0" class="{*$cf_controller*}">
    <tr>
        <td width="1979" valign="top" bgcolor="#FFFFFF">


            <div class="wrapper pr_8">                {*if $cf_action=='add' || $cf_action=='edit'*}

            <script type="text/javascript">
                $(function(){
                    $("#act_form").submit(function(){
                        var txtval = $("#question_title").val().length;
                        if(txtval > 50){
                            my_alert('题目不能超过50个字','Error',"$('#question_title').focus()");
                            return false;
                        }

                        if($("#question_title").val()==''){
                            my_alert('请输入题目内容','Error',"$('#question_title').focus()");
                            return false;
                        }

                        if($("#question_list0").val()=='' || $("#question_list1").val()=='' || $("#question_list2").val()=='' || $("#question_list3").val()==''){
                            my_alert('请输入题目内容','Error',"$('#question_list0').focus()");
                            return false;
                        }

                    });

					$("#question_user").autocomplete("/admin/ajax-act_searchuser.htm", {
						minChars: 1,					//最少输入字条
						max: 12,
						autoFill: false,				//是否选多个,用","分开
						mustMatch: true,				//是否全匹配, 如数据中没有此数据,将无法输入
						matchContains: true,			//是否全文搜索,否则只是前面作为标准
						scrollHeight: 220,
						width:400,
						multiple:false,
						dataType:'html',
						formatItem: function(row, i, max) {					//显示格式
						
							return "<span style='width:120px'>"+row[0]+"</span><span style='width:70px'>ID:"+row[1]+"</span><span style='width:80px'>"+row[2]+"</span><span style='width:80px'>"+row[3]+"</span>";
						},
						formatMatch: function(row, i, max) {				//以什么数据作为搜索关键词,可包括中文,
						   return row[1];
				
						},
						formatResult: function(row) {					//返回结果		
							return row[0];
						}
					});				
					
					$("#question_user").result(function(event, row, formatted) {				//额外触发,可不要
						 
						 $("#question_uid").val(row[1]);					//更多操作
						 
					});



                    $("#openlink").click(function(){
                        if($("#question_link").val()!=''){
                            window.open($("#question_link").val(),"参考链接");
                        }

                    });
                    call_uploader('#upload_button','#question_image','image',{'show':'#show',"params":"thumb=240,240"});
                    {*if $row.question_image *}
                        $("#show").append(show_photo_div("#upload_button","#question_image","{*$row.question_image*}"));
                        {*/if*}
                            $("#reason").change(function(){
                                var value = $(this).val();
                                var text = $("#reason option[value='"+value+"']").text();
                                $("#question_reason").val(text);

                            });

                        })

                        function checklength(textarea,maxlength){  //判断文本区域的字符串长度
                            var txtval = $("#"+textarea).val();
                            var	strlen = txtval.length;
                            if(strlen > maxlength){
                                alert('您输入的字已经超过了'+maxlength+'个!');
                                $("#"+textarea).focus();

                            }
                        }


            </script>

            <div class="content_panel_title">
                <div class="contentpanelleft"></div>
                <div class="contentpanelcenter">
                    <span class="contentpanelcenter_font">新增/修改题目</span>
                    <span><a class="edit at" href="{*$cf_self_page*}?dpt={*$cf_dpt*}">题目管理</a></span>                            </div>
                <div class="contentpanelrihgt"></div>
            </div>
            <div class="content_table_center_style">
                <div class="p8">

                    <form name="act_form" id="act_form" method="post" action="{*$cf_self_page*}">
                        <input name="id" id="id" type="hidden" value="{*$row.question_id*}" />
                        <input name="dpt" id="dpt" type="hidden" value="{*$cf_dpt*}" />
                        <input name="act" id="act" type="hidden" value="{*$cf_action*}" />
                        <input name="old_status" id="old_status" type="hidden" value="{*$row.question_status*}" />
                        <input name="question_uid" id="question_uid" type="hidden" value="{*$row.question_uid*}" />
                        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbl tbl_nbr">
                            <tbody>
                            <tr>
                                <td colspan="4" class="stitle">题目信息</td>
                            </tr>
                            <tr>
                                <td width="11%" align="right">题目:</td>
                                <td width="34%" align="left">
                                    <textarea name="question_title" id="question_title" cols="60" rows="2" onkeyup="checklength('question_title',50);" >{*$row.question_title*}</textarea>
                                </td>
                                <td width="14%" align="right">&nbsp;</td>
                                <td width="41%" align="left">&nbsp;</td>
                            </tr>
                            <tr>
                                <td align="right">题库:</td>
                                <td align="left">{*html_radios name=question_part options=$cf_info_var_common.exam_type checked=$row.question_part|default:'0'*}</td>
                                <td align="right">分类:</td>
                                <td align="left">{*html_options name=question_type options=$cf_info_var_common.question_type selected=$row.question_type|default:'0'*}</td>
                            </tr>
                            <tr>
                                <td align="right">作者(用户):</td>
                                <td align="left"><input name="question_user" type="text" id="question_user" value="{*$row.question_user*}" size="30" maxlength="30" /></td>
                                <td align="right">来源:</td>
                                <td align="left">{*html_options name=question_from options=$cf_info_var_common.from selected=$row.question_from|default:'0'*}</td>
                            </tr>
                            <tr>
                                <td height="98" align="right">图片:</td>
                                <td align="left">
                                    <!--<input name="question_image" type="text" id="question_image" value="{*$row.question_image*}" size="40" maxlength="150"/>
                                    <input type="button" id="images" value="选择图片" />-->
                                    <span id='show'><img style="cursor:pointer" id="upload_button" src="/public/images/admin/upload.jpg"  /></span><input type="hidden" name="question_image" id="question_image" value="{*$row.question_image*}" />
                                    <!--<div id="show"><a href="{*$row.question_image*}" target="_blank"><img src="{*$row.question_image*}"  height="50" width="50" /></a></div>-->
                                </td>
                                <td align="right">&nbsp;</td>
                                <td align="left">&nbsp;</td>
                            </tr>
                            <tr>
                                <td align="right">选项:</td>
                                <td align="left">A:
                                    <input name="question_optionA" type="text" id="question_optionA" value="{*$row.question_optionA*}" size="40" maxlength="15" />
                                    <br />
                                    B:
                                    <input name="question_optionB" type="text" id="question_optionB" value="{*$row.question_optionB*}" size="40" maxlength="15" />
                                    <br />
                                    C:
                                    <input name="question_optionC" type="text" id="question_optionC" value="{*$row.question_optionC*}" size="40" maxlength="15" />
                                    <br />
                                    D:
                                    <input name="question_optionD" type="text" id="question_optionD" value="{*$row.question_optionD*}" size="40" maxlength="15" /></td>
                                <td align="right">&nbsp;</td>
                                <td align="left">&nbsp;</td>
                            </tr>
                            <tr>
                                <td align="right">答案:</td>
                                <td align="left">{*html_radios name=question_answer options=$cf_info_var.1 checked=$row.question_answer|default:'A'*}</td>
                                <td align="right">难度:</td>
                                <td align="left">{*html_radios name=question_difficulty options=$cf_info_var.2 checked=$row.question_difficulty|default:'1'*}</td>
                            </tr>
                            <tr>
                                <td align="right">参考资料:</td>
                                <td colspan="3" align="left"><textarea name="question_reference" id="question_reference" cols="60" rows="5">{*$row.question_reference*}</textarea></td>
                            </tr>
                            <tr>
                                <td align="right">参考链接:</td>
                                <td colspan="3" align="left"><input name="question_link" type="text" id="question_link" value="{*$row.question_link*}" size="70" maxlength="100" />
                                    &nbsp;
                                    <input type="button" name="openlink" id="openlink" value="点击查看"  /></td>
                            </tr>

                            <!-- <tr id="uploadify_part">
                                 <td align="right">已上傳圖片:</td>
                                 <td colspan="3" align="left"><div id="uploadify_list"></div><input type="button" id="uploadify_del" name="uploadify_del" value="删除圖片" class="myinput1"  /></td>
                             </tr>-->
                            <tr>
                                <td colspan="4" class="stitle">其它信息</td>
                            </tr>
                            <tr>
                                <td align="right">审核情况:</td>

                                <td align="left">
                                    <!--  {*if $row.question_status > '0'*}
                                      {*html_radios name=question_status options=$cf_info_var_common.check checked=$row.question_status|default:'1' disabled="disabled"*}
                                      {*else*}
                                      {*html_radios name=question_status options=$cf_info_var_common.check checked=$row.question_status|default:'1' *}
                                      {*/if*}-->

                                    {*html_radios name=question_status options=$cf_info_var_common.check checked=$row.question_status|default:'1' *}
                                </td>
                                <td align="right">不通过理由:</td>
                                <td align="left"><input name="question_reason" type="text" id="question_reason" value="{*$row.question_reason*}" size="30" maxlength="30" />
                                    &nbsp;
                                    {*html_options name=reason id=reason options=$reason selected=''*}</td>
                            </tr>
                            {*if $row.question_status=='0'*}
                            <tr>
                                <td align="right">积分奖励:</td>
                                <td align="left">
                                    {*html_radios name=question_score options=$cf_info_var.4 checked='30'*}
                                </td>
                                <td align="right">&nbsp;</td>
                                <td align="left">&nbsp;</td>
                            </tr>
                            {*/if*}
                            <tr>
                                <td align="right">创建时间:</td>
                                <td align="left">{*$row.question_create_time*}</td>
                                <td align="right">&nbsp;</td>
                                <td align="left">&nbsp;</td>
                            </tr>

                            </tbody>
                        </table>
                        <div class="pt_8" align="center"><input type="submit" name="Submit" value="提 交" class="myinput" />
                            &nbsp;&nbsp;
                            <input type="button" name="back" value="返 回" onclick="window.history.back()" class="myinput" /></div>
                    </form>
                </div>
            </div>
            <div class="content_main_bottom">
                <div class="content_main_bottom_left"></div>
                <div class="content_main_bottom_right"></div>
            </div>
            <div style="display:none"><ul id="copy_info"><li><b><input name="item_name[]" type="text" class="item_name" size="52" /></b><span><input name="item_price[]" type="text" class="item_price ismoney" value="0" size="8"  /></span><span><input name="item_count[]" type="text" class="item_count isnum" value="1" size="8" /></span><span><input name="item_total[]" type="text" class="item_total ismoney" value="0" size="8" readonly="readonly" /></span><span><a href="javascript:void(0)" class="del_item"><img src="public/images/admin/close.png" /></a></span></li></ul></div>
            {*else*}


                <script type="text/javascript">  
					
					$(function(){

						$("#checkall").toggle(
						function(){
							select_all("idlist[]",true);
						},
						function(){
							select_all("idlist[]",false);
						});
						$("#list_form").submit(function(){
							if(!count_select("idlist[]")){
								my_alert('请选择id记录','Error');
								return false;
							};
							if($("#alltype").val()==''){
								my_alert('请选择操作方式','Error',"$('#alltype').focus()");
								return false;
							};
								if(confirm('确定进行操作?')==false){
								return false;
							}
							return true;
						});	
					});


                </script>
                <div class="pannel">
                    <div class="pl"></div>
                    <div class="pr"></div>
                    <div class="pc1">
                        <form action="" method="get" id="search_form" name="search_form">
                            <input name="dpt" id="dpt" type="hidden" value="{*$cf_dpt*}" />
							<input name="self" id="self" type="hidden" value="{*$self*}" />
                            <div class="pt">
                                题目名称:
                                  <input type="text" size="12" id="skey" name="skey" class="tet" value="{*$skey*}" />
                                &nbsp;&nbsp;用户:
                                <input type="text" size="12" id="skey2" name="skey2" class="tet" value="{*$skey2*}" />
                                &nbsp;&nbsp;
								板块{*html_options name=skey3 id=skey3 options=$part selected=$skey3|default:''*}
								分类:{*html_options name=stype options=$type selected=$stype*}&nbsp;
								难度:{*html_options name=stype3 options=$difficulty selected=$stype3*}&nbsp;
								答题尾数{*html_options name=stype2 id=stype2 options=$type2 selected=$stype2|default:''*}
								<input type="image" src="public/images/admin/icon_search_btn.gif">
                            </div>
                        </form>
                    </div>
                </div>
                <div class="content_panel_title">
                    <div class="contentpanelleft"></div>
                    <div class="contentpanelcenter">
                        <span class="contentpanelcenter_font">题目管理</span>
                        <span><a class="edit at" href="{*$cf_self_path*}-act_add.htm?dpt={*$cf_dpt*}">新增题目</a></span>&nbsp;
                        </div>
                    <div class="contentpanelrihgt"></div>
                </div>
                <div class="content_table_center_style">
                    <div class="p8">
                        <div class="bq clearfix">
                            <b><a href="{*$cf_self_path*}-act_index.htm?dpt={*$cf_dpt*}" class="{*if $self==''*}active{*/if*}">所 有 </a></b><b><a href="{*$cf_self_path*}-act_index.htm?dpt={*$cf_dpt*}&self=0" class="{*if $self=='0'*}active{*/if*}" >待 审</a></b> <b><a href="{*$cf_self_path*}-act_index.htm?dpt={*$cf_dpt*}&amp;self=1" class="{*if $self==1*}active{*/if*}" >已通过</a></b><b><a href="{*$cf_self_path*}-act_index.htm?dpt={*$cf_dpt*}&self=2" class="{*if $self==2*}active{*/if*}" >不通过</a></b></div>
                        <form name="list_form" id="list_form" method="post" action="{*$cf_self_page*}">
                            <input name="act" type="hidden" value="all" />
                            <input name="dpt" type="hidden" value="{*$cf_dpt*}" />
                            <table width="100%" class="tbl tbl_nbr">
                                <thead>
                                    <tr class="thd">
                                        <td width="4%" align="center" class="thr">选择</td>
                                        <td width="4%" align="center" class="thr">&nbsp;</td>
                                        <td width="26%" align="center" class="thr">标题</td>
										<td width="7%" align="center" class="thr">参考图</td>
                                        <td width="5%" align="center" class="thr">题库</td>
                                        <td width="8%" align="center" class="thr">分类</td>
                                        <td width="6%" align="center" class="thr">难度</td>
                                        <td width="9%" align="center" class="thr">作者</td>
                                        <td width="7%" align="center" class="thr">对/错</td>
                                        <td width="5%" align="center" class="thr">成功率</td>
                                        <td width="8%" align="center" class="thr">审核状态</td>
                                        <td colspan="2" align="center" class="thr">操作</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    {*foreach name=lead_part item=item from=$data_ary*}
                                    {*assign var=status value=$item.question_status *}
                                    {*assign var=type value=$item.question_type *}
									{*assign var=from value=$item.question_from *}
									{*assign var=diff value=$item.question_difficulty *}
									

                                    <tr onmouseout="this.style.backgroundColor='#ffF'" onmouseover="this.style.backgroundColor='#ffC'">
                                        <td align="center"><input type="checkbox" class="itembox" name="idlist[]" value="{*$item.question_id*}" style="height:15px;" /></td>
                                        <td align="left">{*$item.question_id*}</td>
                                        <td align="left"><a href="javascript:void(0)" title="查看詳情" onclick="$(function(){my_iframe('{*$cf_module_path*}detail-act_question.htm?id={*$item.question_id*}','查看问题詳情',800,500)})" class="edit" >
                                        	{*$item.question_title|truncate:46*}
                                        </a></td>
                                        <td align="center">{*if $item.quesetion_image*}{*/if*}</td>
										<td align="center">{*$item.question_part*}</td>
                                        <td align="center">{*$cf_info_var_common.question_type.$type*}</td>
                                        <td align="center">{*$cf_info_var.2.$diff*}</td>
                                        <td align="center"><a href="javascript:void(0)" title="用户详情" onclick="$(function(){my_iframe('{*$cf_module_path*}detail-act_user.htm?id={*$item.question_uid*}','用户詳情',700,500)})" class="edit" >{*$item.question_user*}</a></td>
                                        <td align="center">{*$item.question_right*}/{*$item.question_wrong*}</td>
                                        <td align="center">{*$item.rate*}</td>
                                        
                                        <td align="center">{*$cf_info_var_common.check.$status*}</td>
                                        <td width="7%" align="center"><a href="{*$cf_self_path*}-act_edit_id_{*$item.question_id*}.htm?dpt={*$cf_dpt*}" class="edit">修改</a></td>
                                        <td width="4%" align="center"><a href="{*$cf_self_path*}-act_del_id_{*$item.question_id*}.htm" class="del" onclick="return confirm('你确定要删除吗?')">删除</a></td>
                                    </tr>

                                    {*/foreach*}


                                    <tr class="tft">
                                        <td colspan="13" style="padding:0;">
                                            <table width="100%" border="0">
                                                <tr>
                                                    <td width="6%" align="center" style="border:0;padding:0;"><input type="button" name="checkall" id="checkall" class="myinput" value="全 选" /></td>
                                                    <td width="22%" align="center" style="border:0;padding:0;">
                                                        <select name="alltype" id="alltype">
                                                            <option selected="selected" value="">操作选择</option>
                                                            <option value="allone">移动到日积月累</option>
															<option value="alltwo">移动到我是牛人</option>
															<option value="allright">答对加1</option>
															<option value="allright2">答对加2</option>
															<option value="allright3">答对加3</option>
															<option value="allright-1">答对减1</option>
															<option value="allright-2">答对减2</option>
															<option value="alldiff1">转为容易</option>
															<option value="alldiff2">转为普通</option>
															<option value="alldiff3">转为困难</option>
                                                            <!--<option value="allcheck">通過審核</option>
                                                            <option value="alloutcheck">審核不通過</option>-->
                                                        </select>
                                                        &nbsp;<input type="submit" name="submit_all" id="submit_all" value="批量操作" class="myinput" /></td>
                                                    <td width="72%" style="border:0;padding:0;" ><div class="turnPage"><p>{*$page*}</p></div></td>
                                                </tr>
                                            </table>                                </td>
                                    </tr>
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
                <div class="content_main_bottom">
                    <div class="content_main_bottom_left"></div>
                    <div class="content_main_bottom_right"></div>
                </div>

                {*/if*}
            </div>        </td>
    </tr>
</table>
{*include file="template/admin_foot.htm"*}